package cn.edu.ecut.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet( "/sign/in" )
public class SignInServlet extends HttpServlet {

	private static final long serialVersionUID = 3041157095321358786L;

	@Override
	protected void service( HttpServletRequest request , HttpServletResponse response ) 
			throws ServletException, IOException {
		
		// 通过 request 对象来获取 来自表单的数据
		String user = request.getParameter( "username" );
		String pass = request.getParameter( "password" );
		
		System.out.println( user + " , " + pass );
		
		response.setHeader( "content-type" , "text/html;charset=UTF-8" );
		PrintWriter out = response.getWriter();
		
		out.println( "<h1>" );
		
		out.println( "Welcome , " + user + " !" );
		
		out.println( "</h1>" );
		
	}
	
}
